<?php
ob_start();
require_once '../sub/init.php';
if(!is_mobile())header("Location: ".Href('my_info'));
$currfields = 'dataflag,grade,sex,photo_s,photo_f,weixin_pic,myinfobfb';
require_once ZEAI.'m/my_chk_u.php';
require_once ZEAI.'cache/config_vip.php';
require_once ZEAI.'cache/udata.php';
require_once ZEAI.'cache/config_up.php';
require_once ZEAI.'sub/zeai_up_func.php';
require_once ZEAI.'sub/ZeaiUP.php';
$t = (ifint($t,'1-3','1'))?$t:1;
$SHALOU_ROW=shalou_data($cook_uid,'all');
$photo_f_sl=$SHALOU_ROW['photo_f'];
$SHALOU_ARR=(!empty($SHALOU_ROW))?json_decode($SHALOU_ROW['jsonstr'],true):'';
$cook_grade    = intval($row['grade']);
$cook_dataflag = $row['dataflag'];
$data_photo_s  = $row['photo_s'];
$cook_photo_f  = $row['photo_f'];
$cook_myinfobfb= $row['myinfobfb'];
$FA=udata_arr('all','userF');
$currfields_sl=$FA.',areatitle,area2title,'.get_mate_fld('list');
if($submitok == 'submitCut_success'){
	//裁切新头像处理
	if(!empty($_cut)){
		$shalou_photo_s = $SHALOU_ARR['photo_s'];
		$_s = cut_save('u',$_cut,'all');
		//$db->query("UPDATE ".__TBL_USER__." SET photo_s='".$_s."',photo_f=1 WHERE id=".$uid);
		//$db->query("UPDATE ".__TBL_SHALOU__." SET photo_f=1 WHERE uid=".$uid);
		//set_data_ed_bfb($uid);
		//$SHALOU_ARR=shalou_data($uid);
		$SHALOU_ARR['photo_s']=$_s;
		$jsonstr = encode_json($SHALOU_ARR);
		$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$jsonstr',photo_f=0,addtime=".ADDTIME." WHERE uid=".$uid);
		//删老
		if(!empty($data_photo_s) && $shalou_photo_s!=$data_photo_s){
			UP_modFn('u','del',$shalou_photo_s.'|'.smb($shalou_photo_s,'m').'|'.smb($shalou_photo_s,'b').'|'.smb($shalou_photo_s,'blur'));
		}
		json_exit(array('flag'=>1,'msg'=>'裁切成功'));
	}else{
		json_exit(array('flag'=>0,'msg'=>'上传裁切更新失败'));
	}
}
if (!empty($SHALOU_ARR) && @count($SHALOU_ARR)>0){
	$cook_sex      = $SHALOU_ARR['sex'];
	$cook_photo_s  = $SHALOU_ARR['photo_s'];
	$cook_weixin_pic= $SHALOU_ARR['weixin_pic'];
	$cook_nickname = trimhtml(dataIO($SHALOU_ARR['nickname'],'out'));
	$cook_myinfobfb= get_shalou_ed_bfb($SHALOU_ARR);
}else{
	$row = $db->ROW(__TBL_USER__,$currfields_sl,"id=".$cook_uid,"name");
	$jsonstr=encode_json($row);
	$db->query("INSERT INTO ".__TBL_SHALOU__." (uid,jsonstr,addtime) VALUES ($cook_uid,'$jsonstr',".ADDTIME.")");
	header("Location: my_info.php?t=$t");exit;
}
$data_photo_s   = $row['photo_s'];
$data_weixin_pic= $row['weixin_pic'];
$myinfo_SaveTip=str_replace('"',"",dataIO($_ZEAI['myinfo_SaveTip'],'outadm'));
$myinfo_SaveTip=(empty($myinfo_SaveTip))?'请等待我们人工审核，审核通过以后将自动覆盖更新以前老资料！':$myinfo_SaveTip;
$data_nomodF=explode(',',$_ZEAI['data_nomodF']);

//文本填写资料正式库
$row_item = $db->ROW(__TBL_USER__,$currfields_sl,"id=".$cook_uid,"name");
if($_ZEAI['data_sh_item']=='text'){
	$if_data_sh_item=($cook_dataflag==1)?true:false;
}
if($submitok=='modupdate1'){
	$form_data1=udata_arr('basic_form');
	$form_data2=udata_arr('contact');
	$form_data=array_merge($form_data1,$form_data2);
	foreach($form_data as $F){
		$T = $F['fieldname'];$subkind = $F['subkind'];
		$F = $F['fieldname'];
		$V = $$F;
		if($F=='sex' || $F=='parent' || $F=='mob' || (@in_array($F,$data_nomodF) && !empty($row_item[$F]) ))continue;
		
		if($subkind==1){
			$V=($F=='aboutus')?dataIO(trimhtml($V,'keep_rn'),'in'):trimhtml($V);
			if($row_item[$F]!=$V && !empty($V) && $_ZEAI['data_sh_item']=='text')$if_data_sh_item=false;//文本填写资料，文本值有变化，进入沙漏
		}elseif($subkind==2){
			$V=intval($V);
		}
		switch ($F) {
			case 'areaid':
				$SHALOU_ARR['areatitle']=$areatitle;
			break;
			case 'area2id':
				$SHALOU_ARR['area2title']=$area2title;
			break;
			case 'aboutus':
				if(str_len($V)>2000)zeaialert('{"title":"【'.$T.'】字太多，请控制在2000个字以内","btnt":"朕知道了","url":"-1"}');
			break;
			case 'nickname':
				if(str_len($V)>50)zeaialert('{"title":"【'.$T.'】字太多，请控制在50个字以内","btnt":"朕知道了","url":"-1"}');
			break;
		}
		if(!empty($V))$SHALOU_ARR[$F]=$V;
	}
	$jumpurl=dataIO($jumpurl,'out');$jumpurl=(!empty($jumpurl))?$jumpurl:'my_info.php?t=2';
	$tipsjson   = '{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center><br>'.$myinfo_SaveTip.'","btnt":"朕知道了","url":"'.$jumpurl.'"}';
	$switch     = json_decode($_ZEAI['switch'],true);
	$dataflag   = ($switch['sh']['moddata_'.$cook_grade] == 1)?1:0;
	$photoMflag = ($switch['sh']['photom_'.$cook_grade] == 1)?1:0;
	//更新主库
	if($dataflag==1 || $if_data_sh_item){
		if(is_array($SHALOU_ARR) && count($SHALOU_ARR)>0){
			$SQLli="";
			foreach ($SHALOU_ARR as $k=>$AV){
				if($k!='photo_s' && $k!='weixin_pic' && !empty($AV) )$SQLli.=",".$k."='".$AV."'";
			}
			$db->query("UPDATE ".__TBL_USER__." SET dataflag=1".$SQLli." WHERE id=".$cook_uid);
			set_data_ed_bfb($cook_uid);
			$tipsjson='{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center>","btnt":"朕知道了","url":"-1"}';//my_info.php?t=2
		}
	}else{
		$db->query("UPDATE ".__TBL_USER__." SET dataflag=0 WHERE id=".$cook_uid);
	}
	//新头像处理
	if(!empty($photo_s) && strrpos($photo_s,'tmp')){
		if($photoMflag==1){
			$_s=u_pic_reTmpDir_send($photo_s,'m');
			u_pic_reTmpDir_send(smb($photo_s,'m'),'m');
			u_pic_reTmpDir_send(smb($photo_s,'b'),'m');
			u_pic_reTmpDir_send(smb($photo_s,'blur'),'m');
			$db->query("UPDATE ".__TBL_USER__." SET photo_s='".$_s."',photo_f=1 WHERE id=".$cook_uid);
			$db->query("UPDATE ".__TBL_SHALOU__." SET photo_f=1 WHERE uid=".$cook_uid);
			set_data_ed_bfb($cook_uid);
			$SHALOU_ARR['photo_s']=$_s;
			//删老
			if(!empty($data_photo_s) && $data_photo_s!=$photo_s){
				@up_send_userdel($data_photo_s.'|'.smb($data_photo_s,'m').'|'.smb($data_photo_s,'b').'|'.smb($data_photo_s,'blur'));
			}
		}else{
			$db->query("UPDATE ".__TBL_SHALOU__." SET photo_f=0 WHERE uid=".$cook_uid);
		}
	}
	//新微信图片
	if(!empty($weixin_pic) && strrpos($weixin_pic,'tmp')){
		if($dataflag==1){
			if(!empty($data_weixin_pic) && $data_weixin_pic!=$weixin_pic){
				@up_send_userdel($data_weixin_pic);
			}
			$_s=u_pic_reTmpDir_send($weixin_pic,'weixin');
			$db->query("UPDATE ".__TBL_USER__." SET weixin_pic='$_s' WHERE id=".$cook_uid);
			set_data_ed_bfb($cook_uid);
			$SHALOU_ARR['weixin_pic']=$_s;
		}
	}
	Dmod(encode_json($SHALOU_ARR));
	zeaialert($tipsjson);
}elseif($submitok=='modupdate2'){
	$form_data=udata_arr('ext');
	foreach($form_data as $F){
		$T = $F['fieldname'];$subkind = $F['subkind'];
		$F = $F['fieldname'];
		if($F=='tag2')continue;if($F=='tag1')$F='tag';
		$V = $$F;
		if($subkind==1){
			$V=dataIO(trimhtml($V),'in');
			if($row_item[$F]!=$V  && !empty($V) && $_ZEAI['data_sh_item']=='text')$if_data_sh_item=false;//文本填写资料，文本值有变化，进入沙漏
		}elseif($subkind==2){
			$V=intval($V);
		}
		if(str_len($V)>100)zeaialert('{"title":"【'.$T.'】字太多，请控制在100个字以内","btnt":"朕知道了","url":"-1"}');
		$SHALOU_ARR[$F]=$V;
	}
	$tipsjson='{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center><br>'.$myinfo_SaveTip.'","btnt":"朕知道了","url":"my_info.php?t=3"}';
	$switch     = json_decode($_ZEAI['switch'],true);
	$dataflag   = ($switch['sh']['moddata_'.$cook_grade] == 1)?1:0;
	//更新主库
	if($dataflag==1 || $if_data_sh_item){
		if(is_array($SHALOU_ARR) && count($SHALOU_ARR)>0){
			$SQLli="";
			foreach ($SHALOU_ARR as $k=>$AV){
				if(!empty($AV))$SQLli.=",".$k."='".$AV."'";
			}
			$db->query("UPDATE ".__TBL_USER__." SET dataflag=1".$SQLli." WHERE id=".$cook_uid);
			set_data_ed_bfb($cook_uid);
			$tipsjson='{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center>","btnt":"朕知道了","url":"-1"}';//my_info.php?t=3
		}
	}else{
		$db->query("UPDATE ".__TBL_USER__." SET dataflag=0 WHERE id=".$cook_uid);
	}
	Dmod(encode_json($SHALOU_ARR));
	zeaialert($tipsjson);
}elseif($submitok=='modupdate3'){
	$mate_diy = explode(',',$_ZEAI['mate_diy']);
	$mateARR = array();
	if(count($mate_diy) >= 1 && is_array($mate_diy)){
		foreach ($mate_diy as $F) {
			switch ($F) {
				case 'areaid':
					$SHALOU_ARR['mate_areaid']=$form_mate_areaid;
					$SHALOU_ARR['mate_areatitle']=$form_mate_areatitle;
					//
					$mateARR['mate_areaid']=$form_mate_areaid;
					$mateARR['mate_areatitle']=$form_mate_areatitle;
				break;
				case 'areaid2':
					$SHALOU_ARR['mate_areaid2']=$form_mate_areaid2;
					$SHALOU_ARR['mate_areatitle2']=$form_mate_areatitle2;
					//
					$mateARR['mate_areaid2']=$form_mate_areaid2;
					$mateARR['mate_areatitle2']=$form_mate_areatitle2;
				break;
				default:
					$ext = mate_diy_par($F,'ext');
					if($ext=='radiorange'){
						$mate_F = 'form_mate_'.$F;
						$mate_form=explode(',',$$mate_F);
						$mate_form1=$mate_form[0];$mate_form2=$mate_form[1];
						$SHALOU_ARR['mate_'.$F.'1']=$mate_form1;
						$SHALOU_ARR['mate_'.$F.'2']=$mate_form2;
						//
						$mateARR['mate_'.$F.'1']=$mate_form1;
						$mateARR['mate_'.$F.'2']=$mate_form2;
					}else{
						$mate_F = 'form_mate_'.$F;
						$SHALOU_ARR['mate_'.$F]=$$mate_F;
						//
						$mateARR['mate_'.$F]=$$mate_F;
					}
				break;
			}
		}
	}
	$SHALOU_ARR['mate_other'] = dataIO(trimhtml($form_mate_other,'keep_rn'),'in',500);
	$href = (!empty($jumpurl))?dataIO($jumpurl,'out'):'my_info.php?t='.$t;
	$tipsjson='{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center><br>'.$myinfo_SaveTip.'","btnt":"朕知道了","url":"'.$href.'"}';
	//更新主库
	//if($dataflag==1 || $if_data_sh_item){
		if(is_array($mateARR) && count($mateARR)>0){
			$SQLli="";
			foreach ($mateARR as $k=>$AV){
				if(!empty($AV))$SQLli.=",".$k."='".$AV."'";
			}
			$SQLli = ltrim($SQLli,',');
			if(!empty($SQLli))$db->query("UPDATE ".__TBL_USER__." SET ".$SQLli." WHERE id=".$cook_uid);
			set_data_ed_bfb($cook_uid);
			$tipsjson='{"title":"<center class=\"C090 S18 B\"><i class=\"ico\">&#xe67f;</i> 保存成功</center>","btnt":"朕知道了","url":"-1"}';
		}
	//}else{
	//	$db->query("UPDATE ".__TBL_USER__." SET dataflag=0 WHERE id=".$cook_uid);
	//}
	Dmod(encode_json($SHALOU_ARR));
	zeaialert($tipsjson);
}
$photo_s_url = (!empty($cook_photo_s))?UP.$cook_photo_s:RES.'photo_m.jpg';
$nav='my';
switch ($t) {
	case 1:$tbt = '基本资料';break;
	case 2:$tbt = '详细资料';break;
	case 3:$tbt = '择偶要求';break;
}?>
<!doctype html><html><head><meta charset="utf-8">
<title>我的-<?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/my_info.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/udata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo HOST;?>/cache/areadata.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>zeai_ios_select/separate/select.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/zeai_div_area.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/birthday.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>
	wx.config({debug: false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
		nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		signature: '<?php echo $signPackage["signature"];?>',
		jsApiList: ['chooseImage','uploadImage','previewImage','hideMenuItems']
	});
	</script>
<?php }?>
<script>var upurl='<?php echo SELF;?>',upMaxMB = <?php echo $_UP['upMaxMB']; ?>,browser='<?php echo browser();?>',up2='<?php echo $_ZEAI['up2'];?>/',Sbindbox = 'ZEAI_CN__FORM',t=<?php echo $t;?>,maxnum=1;</script>
<script src="<?php echo RES;?>m/js/ZeaiUP.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<style>
.my_info_bfb{line-height:2.4rem;width:88%;margin:0 auto;border-radius:1.5rem;overflow:hidden;margin:1rem auto 2rem auto;position:relative;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;border:#eee 1px solid}
.my_info_bfb i{width:2.4rem;height:2.4rem;display:block;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.2);border:#fff 1px solid;border-radius:1.5rem 0 0 1.5rem;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}
.my_info_bfb span{text-align:center;position:absolute;width:100%;top:1px;left:0;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.my_info_bfb_nb i{background-color:#daf4db}
.my_info_bfb_nb span{color:#090;font-size:1.3rem}
.tabmenu a.ed:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
header.bgcolor{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.nextbtn button{box-shadow:0 .3rem .8rem rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.4);background-color:#fff;background:-webkit-linear-gradient(315deg,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.6) 0%,<?php echo $_ZEAI['mob_mbcolor'];?> 100%)}
.areabox .ul li a.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.1)}
.areabox .ul dt.ed,.listbox dl dd span.ed{color:<?php echo $_ZEAI['mob_mbcolor'];?>;border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.divBtmMod .divBtmSave,.listbox .ios-select-widget-box header.iosselect-header a.sure {background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.listbox dl dd span font.tips,.listbox dl dd span font.photo0tips{border:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.8) 1px solid;color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.8)}
<?php
if ($_ZEAI['m_mb']==2){
	echo '.TRnav_btn i{color:'.$_ZEAI['mob_mbcolor'].'}';
	echo '.tabmenufix{width:70%;max-width:500px;top:1.5rem;margin:auto;left:0;right:0}';
	echo '#ZEAI_CN__FORM{padding-top:5rem}';
	$mini_class='top_mini4';
}else{
	echo '.tabmenufix{top:6.7rem}';
	echo '#ZEAI_CN__FORM{padding-top:8.8rem}';
	$mini_class='top_mini4 zeaibg bgcolor yunbox';
}
?>
</style>
</head>
<body>
<?php
if(!empty($jumpurl)){
	$mini_href ='zeai.openurl(\''.trimhtml(dataIO($jumpurl,'out')).'\');';
}
$mini_title=$tbt;
require_once ZEAI.'m/top_mini.php';?>
<div class="tabmenu tabmenu3 tabmenufix">
	<a href="my_info.php?t=1"<?php echo ($t == 1)?' class="ed"':'';?>>基本资料</a>
	<a href="my_info.php?t=2"<?php echo ($t == 2)?' class="ed"':'';?>>详细资料</a>
	<a href="my_info.php?t=3&jumpurl=<?php echo $jumpurl;?>"<?php echo ($t == 3)?' class="ed"':'';?>>择偶要求</a>
</div>
<form class="listbox form<?php echo $t;?>" id="ZEAI_CN__FORM">
    <div id="my_info_bfb" class="my_info_bfb<?php if ($cook_myinfobfb >= 90){echo ' my_info_bfb_nb';}?>">
        <i id="my_info_bfbbar"></i><span>当前资料完善度<?php echo $cook_myinfobfb;?>％</span>
    </div> 
	<script>
    var bfbbgW=my_info_bfb.offsetWidth,data_myinfobfb=<?php echo $cook_myinfobfb;?>;
	bfbbgW = bfbbgW/100;
	var newbfbW= parseInt(bfbbgW*data_myinfobfb);
	my_info_bfbbar.style.width=newbfbW+'px';
    </script>
<?php switch ($t){case 1:
/*********基本资料*********/
    $form_data=udata_arr('basic_form');
	$form_data_num=intval(@count($form_data));$form_data_num_end=$form_data_num;
    if (is_array($form_data) && $form_data_num>0){
        $n=1;
        foreach($form_data as $F){
			$F=$F['fieldname'];
            $subkind = udata_title($form_data,$F,'subkind');
            $T = udata_title($form_data,$F);
            $spanid='';
			$DATA = $SHALOU_ARR[$F];
			$DATA_str = '请选择';
			//禁止修改
			if(  !empty($row_item[$F]) && @in_array($F,$data_nomodF))continue;
			//控件类型
            switch ($subkind) {//1:文本,2:单选,3:复选,4:区间,5:特殊
                case 1:$class = 'ipt';$DATA = trimhtml(dataIO($DATA,'wx'),'keep_rn');$DATA_str = $DATA;break;
                case 2:$class='slect';$DATA_str = udata($F,$DATA);break;
                case 3:$class='chckbox';$DATA_str = udata($F,$DATA);break;
				case 4:$class='slect';$DATA_str = udata($F,$DATA);break;
            }
			//控件类型-特殊
            switch ($F) {
                case 'birthday':
					$class='bthdy';$DATA_str = $DATA;
				break;
				case 'areaid':
					$class='aread';$spanid=' id="areatitle"';
					$DATA_str=(!empty($SHALOU_ARR['areatitle']))?$SHALOU_ARR['areatitle']:$DATA_str;
				break;
				case 'area2id':
					$class='aread2';$spanid=' id="area2title"';
					$DATA_str=(!empty($SHALOU_ARR['area2title']))?$SHALOU_ARR['area2title']:$DATA_str;
				break;
                case 'aboutus':$class='txtarea';break;
            }
			//为空默认值
			if(empty($DATA) || $DATA=='0,0'){
				switch ($F) {
					case 'birthday':$Y=date('Y')-23;$DATA=$Y.'-01-15';break;
					case 'edu':$DATA=getarrdef($_UDATA[$F]);break;
					case 'pay':$DATA=getarrdef($_UDATA[$F]);break;
					case 'heigh':$DATA='170';break;
					case 'weigh':$DATA='50';break;
					default:$DATA_str = ($subkind==1)?'请输入':'请选择';break;
				}
			}
			//输出
            if($F=='photo_s'){?>
                <dl class="photo_s dlpic"><dt>头像</dt><dd id="photo_sbtn"><span>
                <?php if (!empty($cook_photo_s)){?>
                	<img src="<?php echo $photo_s_url;?>"><?php if ($cook_photo_f != 1 || $photo_f_sl!= 1){?><font class="photo0tips">审核中</font><?php }?>
                <?php }else{ ?>
                	<i class="ico">&#xe609;</i><font class="tips">点击上传本人近期生活照</font>
                <?php }?>
                </span></dd></dl>
                <input type="hidden" name="photo_s" id="photo_s" value="<?php echo $cook_photo_s;?>">
				<script>
				<?php if(is_h5app()){?>
						photo_sbtn.onclick=function(){
							app_uploads({url:MHOST+"/my_info"+zeai.extname+'?submitok=ajax_tmpB_up_app'},function(e){//ajax_photo_s_tmp_up_app
								var rs=zeai.jsoneval(e);
								if (rs.flag == 1){
									//o('photo_sbtn').html('<span><img src="'+up2+rs._s.replace('_s.','_m.')+'"></span>');
									//o('photo_s').value = rs._s;
									ZeaiM.div_left({obj:cut_box,w:zeai.bodyW()});
									var dbname = e.dbname;
									photo_s.value=dbname;
									cut_tmppic.src=up2+dbname;
									www_a9a_cn_cut = new ZEAICUT(<?php echo $cook_uid;?>);
									www_a9a_cn_cut.wake();
									www_a9a_cn_cut.init();
								}else{
									zeai.msg(rs.msg);
								}
							});
						}
				<?php }else{?>
					ZeaiUP.one({url:'my_info'+zeai.extname,submitokBef:'ajax_tmpB_',btnobj:photo_sbtn,end:function(e){
						if(e.flag==1){
							ZeaiM.div_left({obj:cut_box,w:zeai.bodyW()});
							var dbname = e.dbname;
							photo_s.value=dbname;
							cut_tmppic.src=up2+dbname;
							www_a9a_cn_cut = new ZEAICUT(<?php echo $cook_uid;?>);
							www_a9a_cn_cut.wake();
							www_a9a_cn_cut.init();
						}else{
							zeai.msg(e.msg);
						}
					}});
				<?php }?>
                </script>
				<?php require_once ZEAI.'res/m/cut.html';?>
			<?php
			}elseif($F=='areaid'){?>
                <div id="areabox" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                <input type="hidden" id="form_areaid" name="areaid" value="<?php echo $SHALOU_ARR[$F];?>">
                <input type="hidden" id="form_areatitle" name="areatitle" value="<?php echo $SHALOU_ARR['areatitle'];?>"><?php
			}elseif($F=='area2id'){?>
                <div id="areabox2" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
                <input type="hidden" id="form_area2id" name="area2id" value="<?php echo $SHALOU_ARR[$F];?>">
                <input type="hidden" id="form_area2title" name="area2title" value="<?php echo $SHALOU_ARR['area2title'];?>"><?php
            }else{?>
                <input type="hidden" id="form_<?php echo $F;?>" name="<?php echo $F;?>" value="<?php echo $DATA;?>"><?php
            }
			$dl0=($n % 6==0 || $form_data_num_end==$n)?' dl0':'';
			if($F!='photo_s')echo '<dl id="'.$F.'" class="'.$class.$dl0.'" data="'.$DATA.'"><dt>'.$T.'</dt><dd><span'.$spanid.'>'.$DATA_str.'</span></dd></dl>';
            $n++;
        }
    }
	//联系方式
    $form_data=udata_arr('contact');
    if (is_array($form_data) && @count($form_data)>0){
        foreach($form_data as $F){
			$F=$F['fieldname'];
			if($F=='mob')continue;
            $T = udata_title($form_data,$F);
			$DATA = $SHALOU_ARR[$F];
			if($F=='weixin_pic'){
				$weixin_pic=$DATA;
				$weixin_pic_url = (!empty($weixin_pic))?UP.$weixin_pic:RES.'photo_m.jpg';
				?>
                <dl class="photo_s dlpic"><dt><?php echo $T;?></dt><dd id="weixin_picbtn" <?php if(is_h5app()){ ?>onClick="up_wxphoto_goup()"<?php }?>><span>
                <?php if (!empty($weixin_pic)){?>
                	<img src="<?php echo $weixin_pic_url;?>">
                <?php }else{ ?>
                	<i class="ico">&#xe609;</i><font class="tips">点击上传本人<?php echo $T;?></font>
                <?php }?>
                </span></dd></dl>
                <input type="hidden" name="weixin_pic" id="weixin_pic" value="<?php echo $weixin_pic;?>">
				<script>
                <?php if(is_h5app()){ ?>
						function up_wxphoto_goup(){		
							app_uploads({url:MHOST+"/my_info"+zeai.extname+'?submitok=ajax_weixin_pic_tmp_up_app'},function(e){				
								var rs=zeai.jsoneval(e);								
								if (rs.flag == 1){
									o('weixin_picbtn').html('<span><img src="'+up2+rs.dbname+'"></span>');
									 o('weixin_pic').value = rs.dbname;
								}else{
									zeai.msg(rs.msg);
								}
							});
						}
						<?php }else{?>
				ZeaiUP.one({url:'my_info'+zeai.extname,submitokBef:'ajax_weixin_pic_tmp_',btnobj:weixin_picbtn,end:function(e){
                    if(e.flag==1){
                        o('weixin_picbtn').html('<span><img src="'+up2+e.dbname+'"></span>');
                        o('weixin_pic').value = e.dbname;
                    }else{
                        zeai.msg(e.msg);
                    }
                }});<?php }?>
                </script>
				<?php
            }else{
				$DATA_str = '请输入';
				$class='ipt';
				$DATA     = trimhtml(dataIO($DATA,'out'));
				$DATA_str = (!empty($DATA))?$DATA:$DATA_str;
				echo '<dl id="'.$F.'" class="'.$class.'" data="'.$DATA.'"><dt>'.$T.'</dt><dd><span>'.$DATA_str.'</span></dd></dl>';
				echo '<input type="hidden" id="form_'.$F.'" name="'.$F.'" value="'.$DATA.'">';
			}
		}
	}
    ?>
    <script>
    zeai.listEach(zeai.tag(o('ZEAI_CN__FORM'),'dl'),function(obj){
		var kind='',className=obj.className.replace(' dl0','');
        switch (className){
            case 'aread':
                o('areaid').onclick=function(){
                    ZeaiM.div_up({obj:areabox,h:36});
                    ZEAI_area({areaid:o('form_areaid').value,areatitle:o('form_areatitle').value,ul:areabox.children[0],str:'job',end:function(z,e){
                        o('areatitle').html(e);o('areatitle').class('ed');
                        o('form_areaid').value=z;
                        o('form_areatitle').value=e;
                    }});
                }
            break;
            case 'aread2':
                o('area2id').onclick=function(){
                    ZeaiM.div_up({obj:areabox2,h:36});
                    ZEAI_area({areaid:o('form_area2id').value,areatitle:o('form_area2title').value,ul:areabox2.children[0],str:'hj',datastr:'hj',end:function(z,e){
                        o('area2title').html(e);o('area2title').class('ed');
                        o('form_area2id').value=z;
                        o('form_area2title').value=e;
                    }});
                }
            break;
            default:
                switch (className) {
					case 'ipt':kind = 'input';break;
					case 'txtarea':kind = 'textarea';break;
					case 'bthdy':kind = 'birthday';break;
                    case 'slect':kind = 'select';break;
                    case 'rang':kind = 'range';break;
                    case 'chckbox':kind = 'checkbox';break;
                }
				if(!zeai.empty(kind)){
					ZeaiM.divMod({kind:kind,obj:obj,end:function(e,i){
						o('form_'+obj.id).value=e;
					}});
				}
            break;
        }
    });
    </script>
    <input type="hidden" name="t" value="<?php echo $t;?>">
    <input type="hidden" name="submitok" value="modupdate1">
    <input type="hidden" name="jumpurl" value="<?php echo dataIO($jumpurl,'out');?>">
    <div class="nextbtn"><button type="button" class="btn size4 ed zeaibg" id="save">下一步</button></div>
	<script>save.onclick=function(){ZEAI_CN__FORM.submit();}</script>
<?php break;case 2:
/*********详细资料*********/
	$form_data=udata_arr('ext');
	if (is_array($form_data) && @count($form_data)>0){
        $n=1;
        foreach($form_data as $F){
			$F=$F['fieldname'];
			if($F=='tag2')continue;if($F=='tag1')$F='tag';
			$oldF = $F;
			if($F=='tag'){
				if(!ifint($cook_sex))continue;
				$subkind = udata_title($form_data,'tag'.$cook_sex,'subkind');
				$T = udata_title($form_data,'tag'.$cook_sex);
				$oldF = (ifint($cook_sex))?$F.$cook_sex:$oldF;
			}else{
				$subkind = udata_title($form_data,$F,'subkind');
				$T = udata_title($form_data,$F);
			}
			$DATA     = $SHALOU_ARR[$F];
			$DATA_str = '请选择';
			//控件类型
            switch ($subkind) {//1:文本,2:单选,3:复选,4:区间,5:特殊
                case 1:
					$DATA_str = '请输入';
					$class = 'ipt';$DATA = trimhtml(dataIO($DATA,'out'));
					$DATA_str = (!empty($DATA))?$DATA:$DATA_str;
				break;
                case 2:$class='slect';
					$DATA_str = (!empty($DATA))?udata($F,$DATA):$DATA_str;
				break;
                case 3:$class='chckbox';
					if($F=='tag' && ifint($cook_sex)){
						$str = checkbox_div_list_get_listTitle('tag'.$cook_sex,$DATA);	
					}else{
						$str = udata($F,$DATA);
					}
					$DATA_str = (!empty($DATA))?$str:$DATA_str;
				break;
				case 4:$class='slect';$DATA_str = udata($F,$DATA);break;
            }
			$dl0=($n % 5==0)?' dl0':'';
			echo '<dl id="'.$oldF.'" class="'.$class.$dl0.'" data="'.$DATA.'"><dt>'.$T.'</dt><dd><span>'.$DATA_str.'</span></dd></dl>';
			echo '<input type="hidden" id="form_'.$F.'" name="'.$F.'" value="'.$DATA.'">';
			$n++;
		}
	}
	?>
    <script>
    zeai.listEach(zeai.tag(o('ZEAI_CN__FORM'),'dl'),function(obj){
		var kind='',className=obj.className.replace(' dl0','');
		switch (className) {
			case 'ipt':kind = 'input';break;
			case 'txtarea':kind = 'textarea';break;
			case 'bthdy':kind = 'birthday';break;
			case 'slect':kind = 'select';break;
			case 'rang':kind = 'range';break;
			case 'chckbox':kind = 'checkbox';break;
		}
		if(!zeai.empty(kind)){
			ZeaiM.divMod({kind:kind,obj:obj,end:function(e,i){
				if(obj.id=='tag1' || obj.id=='tag2'){
					o('form_tag').value=e;
				}else{
					o('form_'+obj.id).value=e;
				}
			}});
		}
    });
    </script>
    <input type="hidden" name="t" value="<?php echo $t;?>">
    <input type="hidden" name="submitok" value="modupdate2">
    <div class="nextbtn"><button type="button" class="btn size4 ed zeaibg" id="save">下一步</button></div>
	<script>
	save.onclick=function(){
		ZEAI_CN__FORM.submit();
		//zeai.confirm('确定资料真实提交保存么？',function(){
		//});
	}
    </script>
<?php break;case 3:
/*********择偶要求*********/?>
	<style>
    .mate .ios-select-widget-box header.iosselect-header a.sure,.divBtmMod .divBtmSave,.checkskin:checked + label.checkskin-label i{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>;}
    .checkskin:checked + label.checkskin-label i{border-color:<?php echo $_ZEAI['mob_mbcolor'];?>;}
    .areabox .ul dt.ed{border-top-color:<?php echo $_ZEAI['mob_mbcolor'];?>;color:<?php echo $_ZEAI['mob_mbcolor'];?>}
    </style>
    <div id="mate">
		<?php
		$mate_diy = explode(',',$_ZEAI['mate_diy']);
        if (count($mate_diy) >= 1 && is_array($mate_diy)){
			$n=1;
            foreach ($mate_diy as $F) {
				$D_str='请选择';
                $ext = mate_diy_par($F,'ext');
                switch ($ext) {
                    case 'radio':
                        $class = 'slect';
                        $D     = intval($SHALOU_ARR['mate_'.$F]);
                        $D_str = (ifint($D))?udata($F,$D):$D_str;
                    break;
                    case 'radiorange':
                        $class  = 'rang';
                        $D1     = intval($SHALOU_ARR['mate_'.$F.'1']);
                        $D2     = intval($SHALOU_ARR['mate_'.$F.'2']);
                        $D      = $D1.','.$D2;
                        $dwarr  = json_decode($_UDATA[$F],true);$dw = $dwarr['dw'];
						$D_str  = (ifint($D1) || ifint($D2))?mateset_out($D1,$D2,$dw):$D_str;
						$D_str  = str_replace("不限","",$D_str);
                    break;
                    case 'checkbox':
                        $class = 'chckbox';
                        $D     = $SHALOU_ARR['mate_'.$F];
                        $D_str = (!empty($D))?udata($F,$D):$D_str;
                    break;
                    case 'area':$class = 'aread';break;
                }
                switch ($F) {
                    case 'areaid':
                        $class='aread';$spanid=' id="areatitle"';
                        $D   = $SHALOU_ARR['mate_'.$F];
                        $D_t = $SHALOU_ARR['mate_areatitle'];
						$D_t = str_replace("不限","",$D_t);
						$D_str = (!empty($D))?$D_t:$D_str;
						?>
                        <input type="hidden" id="form_mate_areatitle" name="form_mate_areatitle" value="<?php echo $D_t;?>">
                        <?php
                    break;
                    case 'areaid2':
                        $class='aread2';$spanid=' id="area2title"';
                        $D   = $SHALOU_ARR['mate_'.$F];
                        $D_t = $SHALOU_ARR['mate_areatitle2'];
						$D_t = str_replace("不限","",$D_t);
						$D_str = (!empty($D))?$D_t:$D_str;
						?>
                        <input type="hidden" id="form_mate_areatitle2" name="form_mate_areatitle2" value="<?php echo $D_t;?>">
                        <?php
                    break;
                    default:$spanid='';break;
                }
                //默认值
				$D = str_replace(",,,","",$D);
                if(empty($D) || $D=='0,0'){
                    switch ($F) {
                        case 'age':$D='23,40';break;
                        case 'edu':$D=3;break;
                        case 'pay':$D=5;break;
                        case 'heigh':$D='160,175';break;
                        case 'weigh':$D='50,70';break;
                    }
                }
				$dl0=($n % 5==0)?' dl0':'';
                echo '<dl id="mate_'.$F.'" class="'.$class.$dl0.'" data="'.$D.'"><dt>'.mate_diy_par($F).'</dt><dd><span'.$spanid.'>'.$D_str.'</span></dd></dl>';?>
                <input type="hidden" id="form_mate_<?php echo $F;?>" name="form_mate_<?php echo $F;?>" value="<?php echo $D;?>">
        <?php $n++;}}
		$mate_other = dataIO($SHALOU_ARR['mate_other'],'out');?>
        <dl id="mate_other" class="txtarea" data="<?php echo $mate_other;?>" placeholder="例如：对方三观或您的特殊要求&#13;&#13;（内容请控制在500字以内）"><dt>其他要求</dt><dd><span<?php echo $span_clsname;?>><?php echo (empty($mate_other))?'请输入':$mate_other;?></span></dd></dl>
        <input type="hidden" id="form_mate_other" name="form_mate_other" value="<?php echo $mate_other;?>">
    </div>
    <?php if (in_array('areaid',$mate_diy)){?>
        <div id="areabox" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
    <?php }?>
    <?php if (in_array('areaid2',$mate_diy)){?>
        <div id="areabox2" class="areabox"><div class="ul"><li><dl><dd></dd></dl></li></div></div>
    <?php }?>
    <script src="<?php echo RES;?>zeai_ios_select/separate/select.js?<?php echo $_ZEAI['cache_str'];?>"></script>
    <script src="<?php echo RES;?>m/js/my_info.js?<?php echo $_ZEAI['cache_str'];?>"></script>
    <script>
    Sbindbox = 'mate';
    zeai.listEach(zeai.tag(o('mate'),'dl'),function(obj){
		className=obj.className.replace(' dl0','');
        switch (className){
            case 'aread':
                o('mate_areaid').onclick=function(){
                    ZeaiM.div_up({obj:areabox,h:36});
                    ZEAI_area({bx:true,areaid:o('form_mate_areaid').value,areatitle:o('form_mate_areatitle').value,ul:areabox.children[0],str:'job',end:function(z,e){
                        o('areatitle').html(e);o('areatitle').class('ed');
                        o('form_mate_areaid').value=z;
                        o('form_mate_areatitle').value=e;
                    }});
                }
            break;
            case 'aread2':
                o('mate_areaid2').onclick=function(){
                    ZeaiM.div_up({obj:areabox2,h:36});
                    ZEAI_area({bx:true,areaid:o('form_mate_areaid2').value,areatitle:o('form_mate_areatitle2').value,ul:areabox2.children[0],str:'hj',datastr:'hj',end:function(z,e){
                        o('area2title').html(e);o('area2title').class('ed');
                        o('form_mate_areaid2').value=z;
                        o('form_mate_areatitle2').value=e;
                    }});
                }
            break;
            default:
				var clsName=obj.className.replace(' dl0','');
                switch (clsName) {
                    case 'slect':kind = 'select';break;
                    case 'rang':kind = 'range';break;
                    case 'chckbox':kind = 'checkbox';break;
					case 'txtarea':kind = 'textarea';break;
                }
                ZeaiM.divMod({kind:kind,obj:obj,end:function(e,i){
                    o('form_'+obj.id).value=e;
                }});
            break;
        }
    });
    </script>
    <script src="<?php echo RES;?>m/js/zeai_div_area.js?<?php echo $_ZEAI['cache_str'];?>"></script>
    <input type="hidden" name="t" value="<?php echo $t;?>">
    <input type="hidden" name="submitok" value="modupdate3">
    <input type="hidden" name="jumpurl" value="<?php echo dataIO($jumpurl,'out');?>">
    <div class="nextbtn"><button type="button" class="btn size4 ed zeaibg" id="save">保存资料</button></div>
	<script>save.onclick=function(){ZEAI_CN__FORM.submit();}</script>
<?php break;}?>
</form>
<?php require_once ZEAI.'m/TRnav.php';?>
<div class="blank"></div>
<?php
function Dmod($jsonstr){
	global $db,$cook_uid;
	$uid=intval($cook_uid);
	$row = $db->ROW(__TBL_SHALOU__,"uid","uid=".$uid);
	if ($row){
		$db->query("UPDATE ".__TBL_SHALOU__." SET jsonstr='$jsonstr',addtime=".ADDTIME." WHERE uid=".$uid);
	}else{
		$db->query("INSERT INTO ".__TBL_SHALOU__." (uid,jsonstr,addtime) VALUES ($uid,'$jsonstr',".ADDTIME.")");
	}
}
function udata_title($data_data,$f,$kind='') {foreach($data_data as $v){if($v['fieldname'] == $f)if($kind=='subkind'){return $v['subkind'];}else{return $v['title'];}}}
function getarrdef($arrstr) {
	$arr=json_decode($arrstr,true);
	$cout=intval(count($arr)/2)-1;
	$rt=$arr[$cout]['i'];
	return $rt;
}
//require_once ZEAI.'m/bottom.php';
ob_end_flush();
?>